package info.maxhis.bn.birthday;

import info.maxhis.bn.R;
import info.maxhis.util.SharedData;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
/**
 * 根据名字查找生日
 * @author iStar
 *
 */
public class SearchByNameActivity extends Activity {
	private EditText nameView;
	private Button searchButton;
	private Context context;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		context = this;
		setContentView(R.layout.activity_search_by_name);
		nameView = (EditText) findViewById(R.id.view_name);
		searchButton = (Button) findViewById(R.id.btn_search);
		searchButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String name = nameView.getText().toString();
				if (name == null || "".equals(name)) {
					nameView.setError(getResources().getString(R.string.name_null));
					return ;	
				}
				Intent intent = new Intent(context, BirthdayListActivity.class);
				intent.putExtra("name", name);
				startActivity(intent);
			}
		});
	}
}
